<!-- $Id: listCat.html 121 2011-05-17 10:03:49Z nicholasinlove1986@gmail.com $ -->
<include file="Public:pageheader"/>
<script type="text/javascript">
function sortBy(order,sort){
	location.href = "?order="+order+"&sort="+sort;
}

var optionAjax = new Object;
/**
 * 切换状态
 */
optionAjax.toggle = function(obj, act, id) {
  var val = (obj.src.match(/yes.gif/i)) ? 0 : 1;
  ThinkAjax.send('__URL__/visibleCat','ajax=1&act='+ act + '&val=' + val + '&id=' + id, complete ,'result');
}

function complete(data,status) {
	if (status==1) {
		window.location.reload();
	}
}  
</script>
<form method="post" action="" name="listForm">
<span id="result"></span>
<div class="list-div" id="listDiv">
<table width="100%" cellspacing="1" cellpadding="2" id="list-table">
  <tr>
    <th>{$Think.lang.category_title}</th>
	<th>{$Think.lang.category_url}</th>
    <th>{$Think.lang.category_posts_num}</th>
	<th>{$Think.lang.category_sort}</th>
    <th>{$Think.lang.category_isshow}</th>
    <th>{$Think.lang.handler}</th>
  </tr>
 <volist name="list" id="vo">
  <tr align="center" class="{$vo.level}">
    <td align="left" class="first-cell" width="20%">
      <img src="__PUBLIC__/Images/menu_minus.gif" width="9" height="9" border="0" style="margin-left:{$vo.level}em" onclick="rowClicked(this)" />
      <span><a href="__APP__/Posts/listPosts/catid/{$vo.category_id}">{$vo.category_title}</a></span>
    </td>
    <td width="35%" align="left"><a href="{&blog_domain}index.php/Category/{$vo.category_url}/" target="_blank">{$vo.category_url}</a></td>
    <td width="9%"><a href="__APP__/Posts/listPosts/catid/{$vo.category_id}">{$vo.posts_num}</a></td>
	<td width="9%">{$vo.category_sort}</td>
    <td width="9%"><eq name='vo.category_isshow' value='1'><img src="__PUBLIC__/Images/yes.gif" border="0" height="14" width="14" alt="{$Think.lang.toggle}" onclick="optionAjax.toggle(this, 'category_isshow', '{$vo.category_id}')"><else /><img src="__PUBLIC__/Images/no.gif" border="0" height="14" width="14" alt="{$Think.lang.toggle}" onclick="optionAjax.toggle(this, 'category_isshow', '{$vo.category_id}')"></eq></td>
    <td align="center">
	  <a href="__APP__/Category/movePosts/id/{$vo.category_id}">{$Think.lang.move_posts}</a> |
      <a href="__APP__/Category/editCat/id/{$vo.category_id}">{$Think.lang.edit}</a> |
      <a href="__APP__/Category/dropCat/id/{$vo.category_id}" onclick="return confirm('{$Think.lang.drop_category_confirm}');" >{$Think.lang.drop}</a>
    </td>
  </tr>
 </volist>
</table>
</div>
</form>
<script language="JavaScript">
<!--
var imgPlus = new Image();
imgPlus.src = "__PUBLIC__/Images/menu_plus.gif";

/**
 * 折叠分类列表
 */
function rowClicked(obj)
{
  obj = obj.parentNode.parentNode;

  var tbl = document.getElementById("list-table");
  var lvl = parseInt(obj.className);
  var fnd = false;

  for (i = 0; i < tbl.rows.length; i++)
  {
      var row = tbl.rows[i];

      if (tbl.rows[i] == obj)
      {
          fnd = true;
      }
      else
      {
          if (fnd == true)
          {
              var cur = parseInt(row.className);
              if (cur > lvl)
              {
                  row.style.display = (row.style.display != 'none') ? 'none' : (Browser.isIE) ? 'block' : 'table-row';
              }
              else
              {
                  fnd = false;
                  break;
              }
          }
      }
  }

  for (i = 0; i < obj.cells[0].childNodes.length; i++)
  {
      var imgObj = obj.cells[0].childNodes[i];
      if (imgObj.tagName == "IMG" && imgObj.src != '__PUBLIC__/Images/menu_arrow.gif')
      {
          imgObj.src = (imgObj.src == imgPlus.src) ? '__PUBLIC__/Images/menu_minus.gif' : imgPlus.src;
      }
  }
}
//-->
</script>
<include file="Public:pagefooter"/> 
